﻿#查找路径下面所有源文件
aux_source_directory(. SRC_LIST)

SET(PD_SRC ${CMAKE_CURRENT_SOURCE_DIR})
file(GLOB MAIN_HEADER_FILES ${PD_SRC}/xml2json.hpp)
file(GLOB XML_HEADER_FILES ${PD_SRC}/rapidxml/*.hpp)
file(GLOB JSON_HEADER_FILES ${PD_SRC}/rapidjson/*.h)
file(GLOB JSON_HEADER_FILES_INTERNAL ${PD_SRC}/rapidjson/internal/*.h)
file(GLOB JSON_HEADER_FILES_MSINTTYPES ${PD_SRC}/rapidjson/msinttypes/*.h)
file(GLOB JSON_HEADER_FILES_ERROR ${PD_SRC}/rapidjson/error/*.h)
#设置debug项目名后缀
set(CMAKE_DEBUG_POSTFIX "_gd")

#引用当前文件夹
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidjson)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/rapidxml)

#设置预处理
add_definitions(-DXTTO_EXPORTS)

#设置静态库
add_library(commonLibParserData STATIC ${SRC_LIST})

#设置预编译
SET_TARGET_PROPERTIES(commonLibParserData PROPERTIES COTIRE_CXX_PREFIX_HEADER_INIT "stdafx.h")
cotire(commonLibParserData)

#设置目录
set_target_properties(commonLibParserData PROPERTIES FOLDER "CommonLib")

#复制头文件到inchhvi
install(FILES ${MAIN_HEADER_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData COMPONENT headers)
install(FILES ${XML_HEADER_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData/rapidxml COMPONENT headers)
install(FILES ${JSON_HEADER_FILES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData/rapidjson COMPONENT headers)
install(FILES ${JSON_HEADER_FILES_INTERNAL} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData/rapidjson/internal COMPONENT headers)
install(FILES ${JSON_HEADER_FILES_MSINTTYPES} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData/rapidjson/msinttypes COMPONENT headers)
install(FILES ${JSON_HEADER_FILES_ERROR} DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/include/ParserData/rapidjson/error COMPONENT headers)

install(TARGETS commonLibParserData 
        RUNTIME DESTINATION ${PROJECT_BINARY_DIR}/bin
		ARCHIVE DESTINATION ${PROJECT_SOURCE_DIR}/3rdlib/lib)
		


